package ar.com.temporis.framework.comparator;

import ar.com.temporis.framework.AbstractERPJTestCase;
import ar.com.temporis.framework.common.comparator.BeanComparator;

/**
 * Sample model to test BeansVerifier.
 * 
 * @author raul.bajales@gmail.com
 */
public class BeansVerifierTestsSimpleCases extends AbstractERPJTestCase {

  public void testNullBeans() {
    BeanComparator comparator =
        (BeanComparator) applicationContext.getBean("beanComparator");
    comparator.compare(null, null);
    assertTrue(comparator.comparisonResult());
    assertNull(comparator.getLog());
  }

  public void testOneNullBean() {
    BeanComparator comparator =
        (BeanComparator) applicationContext.getBean("beanComparator");
    comparator.compare(null, "Test");
    assertFalse(comparator.comparisonResult());
    assertNotNull(comparator.getLog());
  }

  public void testOneSameInstances() {
    String instance = "Test";
    BeanComparator comparator =
        (BeanComparator) applicationContext.getBean("beanComparator");
    comparator.compare(instance, instance);
    assertTrue(comparator.comparisonResult());
    assertNull(comparator.getLog());
  }
}
